package com.geekstudy.week2;

import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;

/**
 *
 * https://mvnrepository.com/artifact/com.squareup.okhttp3
 *
 *
 */
public class OkHttpTool {

    public String get(String url) {
        String responseText = null;
        try {
            OkHttpClient okHttpClient = new OkHttpClient();
            Request request = new Request.Builder().url(url).build();
            Response response = okHttpClient.newCall(request).execute();
            responseText = response.body().string();

        } catch(Exception e) {
            System.out.println("OkHttpTool ");
            e.printStackTrace();
        }

        return responseText;
    }
}
